<template>
	<el-dropdown v-for="item in fileList" :key="item.attachId" style="margin-right: 20px;line-height: 23px">
		<span class="el-dropdown-link">{{ item.name }}<i class="el-icon-arrow-down el-icon--right"></i></span>
		<template #dropdown>
			<el-dropdown-menu>
				<el-dropdown-item
					v-if="this.roleFlag==5 && this.isPc==true && ['.docx','.doc','.dot','.wps','.wpt'].includes(item.extName)"
					@click="taoHongFile(item.attachId,item.extName)">套红
				</el-dropdown-item>
				<el-dropdown-item
					v-if="this.roleFlag==4 && this.isPc===true ||(this.roleFlag==5 && !['.docx','.doc','.dot','.wps','.wpt'].includes(item.extName) && this.isPc)"
					@click="editFile(item.attachId,item.extName)">编辑
				</el-dropdown-item>
				<el-dropdown-item v-if="this.roleFlag>=4" @click="deleteFile(item.attachId)">删除</el-dropdown-item>
				<el-dropdown-item v-if="this.roleFlag>=3" @click="downFile(item.attachId,item.extName)">下载
				</el-dropdown-item>
				<el-dropdown-item v-if="this.roleFlag>=2 && this.isPc" @click="printFile(item.attachId,item.extName)">
					打印
				</el-dropdown-item>
				<el-dropdown-item v-if="this.roleFlag>=1 && this.isPc" @click="readFile(item.attachId,item.extName)">
					查看
				</el-dropdown-item>
				<el-dropdown-item v-if="this.preview/*&& this.$TOOL.data.get('OFFICE_TYPE')!=='0' || !this.isPc*/"  @click="previewFile(item.attachId,item.extName)">预览
				</el-dropdown-item>
				<el-dropdown-item v-if="this.showVersion" @click="showFileVersion(item.attachId,item.extName)">版本
				</el-dropdown-item>
			</el-dropdown-menu>
		</template>
	</el-dropdown>
</template>
<script>
import sysConfig from "@/config";
import {isMobile} from "@/utils/util";

export default {
	name: 'Attach Menu',
	components: {},
	props: {
		uid: {type: String},
		attachList: {type: String},
		attachIds: {type: String},
		roleFlag: {type: Number},
		preview: {type: Boolean},
		showVersion: {type: Boolean},
		stepRunId: {type: String}
	},
	data() {
		return {
			dialog: {
				versionSave: false
			},
			fileList: this.attachList,
			isPc: true
		}

	},
	watch: {
		attachIds() {
			if (this.attachIds !== '') {
				this.getAttachList();
			} else {
				this.fileList = [];
			}
		},
		'attachList': {
			handler(val) {
				this.fileList = val;
			}
		},
	},
	mounted() {
		this.getAttachList();
		if (isMobile()) {
			this.isPc = false
		}
	},
	methods: {
		async getAttachList() {
			if (this.attachIds !== '' && this.attachIds !== undefined) {
				let res = await this.$API.file.attach.getAttachList.get({attachIds: this.attachIds});
				if (res.code === 200) {
					this.fileList = res.data;
				} else {
					this.$alert(res.message, "提示", {type: 'error'})
				}
			}
		},
		deleteFile(attachId) {
			let _that = this;
			this.$confirm("是否确认删除选中的文件吗?", "提示", {
				iconClass: "el-icon-question", //自定义图标样式
				confirmButtonText: "确认", //确认按钮文字更换
				cancelButtonText: "取消", //取消按钮文字更换
				showClose: true, //是否显示右上角关闭按钮
				type: "warning", //提示类型  success/info/warning/error
			}).then(function () {  //选择确认进入此方法
				var flagIndex;
				var flag = false;
				for (var index = 0; index < _that.fileList.length; index++) {
					if (attachId == _that.fileList[index].attachId) {
						flag = true;
						flagIndex = index;
					}
				}
				if (flag) {
					_that.fileList.splice(flagIndex, 1);
				}
				let resArr = [];
				_that.fileList.forEach(item => {
					resArr.push(item.attachId);
				})
				_that.$emit('update:attachIds', resArr.join(","));
				_that.$emit('deletesuccess');
			}).then(() => {  //上一个then()执行成功后执行后续方法
			}).catch(function (err) { //取消按钮会视为erro
			});
			this.$emit('success', this.uid);
		},
		editFile(attachId, extName) {
			if (this.$TOOL.data.get("OFFICE_TYPE") === '0') {
				if (sysConfig.DOC_FILE.includes(extName)) {
					POBrowser.openWindowModeless(this.$TOOL.data.get("ATTACH_HOST") + '/office/openword?attachId=' + attachId + '&extName=' + extName + '&openModeType=4', 'width=1200px;height=800px;scroll=no;');
				} else if (sysConfig.EXCEL_FILE.includes(extName)) {
					POBrowser.openWindowModeless(this.$TOOL.data.get("ATTACH_HOST") + '/office/openexcel?attachId=' + attachId + '&extName=' + extName + '&openModeType=4', 'width=1200px;height=800px;scroll=no;');
				} else if (sysConfig.PPT_FILE.includes(extName)) {
					POBrowser.openWindowModeless(this.$TOOL.data.get("ATTACH_HOST") + '/office/openppt?attachId=' + attachId + '&extName=' + extName + '&openModeType=4', 'width=1200px;height=800px;scroll=no;');
				} else if (sysConfig.PDF_FILE.includes(extName)) {
					if (this.$TOOL.data.get("OFD_TYPE") !== '0') {
						this.openPdfFile(attachId, extName, 4);
					} else {
						POBrowser.openWindowModeless(this.$TOOL.data.get("ATTACH_HOST") + '/office/openpdf?attachId=' + attachId + '&extName=' + extName + '&openModeType=4', 'width=1200px;height=800px;scroll=no;');
					}
				} else if (sysConfig.IMG_FILE.includes(extName)) {
					const image = new Image()
					image.src = sysConfig.API_URL + '/get/file/getFileDown?attachId=' + attachId + "&extName=" + extName+"&ddtab=true";
					image.onload = () => {
						image.style.margin = "0 auto"
						image.style.display = "block"
						const newWin = window.open("", "_blank")
						newWin.document.write(image.outerHTML)
					}
				}
			} else if (this.$TOOL.data.get("OFFICE_TYPE") === '2') {
				if (sysConfig.DOC_FILE.includes(extName)) {
					window.open(this.$TOOL.data.get("ATTACH_HOST") + '/office/wps/openword?attachId=' + attachId + '&extName=' + extName + '&openModeType=4&token=' + this.$TOOL.cookie.get("TOKEN")+"&ddtab=true");
				} else if (sysConfig.EXCEL_FILE.includes(extName)) {
					window.open(this.$TOOL.data.get("ATTACH_HOST") + '/office/wps/openexcel?attachId=' + attachId + '&extName=' + extName + '&openModeType=4&token=' + this.$TOOL.cookie.get("TOKEN")+"&ddtab=true");
				} else if (sysConfig.PPT_FILE.includes(extName)) {
					window.open(this.$TOOL.data.get("ATTACH_HOST") + '/office/wps/openppt?attachId=' + attachId + '&extName=' + extName + '&openModeType=4&token=' + this.$TOOL.cookie.get("TOKEN")+"&ddtab=true");
				} else if (sysConfig.PDF_FILE.includes(extName)) {
					this.openPdfFile(attachId, extName, 4)
				} else if (sysConfig.IMG_FILE.includes(extName)) {
					const image = new Image()
					image.src = sysConfig.API_URL + '/get/file/getFileDown?attachId=' + attachId + "&extName=" + extName;
					image.onload = () => {
						image.style.margin = "0 auto"
						image.style.display = "block"
						const newWin = window.open("", "_blank")
						newWin.document.write(image.outerHTML)
					}
				}
			}else if (this.$TOOL.data.get("OFFICE_TYPE") === '3') {
				if(sysConfig.DOC_FILE.includes(extName)||sysConfig.EXCEL_FILE.includes(extName)||sysConfig.PPT_FILE.includes(extName))
				{
					window.open(this.$TOOL.data.get("ATTACH_HOST")+'/v3/weboffice/index?attachId='+attachId+'&extName='+extName+'&openModeType=4&token='+this.$TOOL.cookie.get("TOKEN")+"&ddtab=true");
				}else if(sysConfig.PDF_FILE.includes(extName))
				{
					this.openPdfFile(attachId,extName,4)
				}else if (sysConfig.IMG_FILE.includes(extName)) {
					const image = new Image()
					image.src = sysConfig.API_URL+'/get/file/getFileDown?attachId=' + attachId + "&extName=" + extName+"&ddtab=true";
					image.onload = () => {
						image.style.margin = "0 auto"
						image.style.display = "block"
						const newWin = window.open("", "_blank")
						newWin.document.write(image.outerHTML)
					}
				}
			}
			this.$emit('success', this.uid);
		},
		taoHongFile(attachId, extName) {
			if (this.$TOOL.data.get("OFFICE_TYPE") === '0') {
				if (sysConfig.DOC_FILE.includes(extName)) {
					POBrowser.openWindowModeless(this.$TOOL.data.get("ATTACH_HOST") + '/office/taohongword?stepRunId=' + this.stepRunId + '&attachId=' + attachId + '&extName=' + extName + '&openModeType=5', 'width=1200px;height=800px;scroll=no;');
				} else if (sysConfig.EXCEL_FILE.includes(extName)) {
					POBrowser.openWindowModeless(this.$TOOL.data.get("ATTACH_HOST") + '/office/openexcel?attachId=' + attachId + '&extName=' + extName + '&openModeType=4', 'width=1200px;height=800px;scroll=no;');
				} else if (sysConfig.PPT_FILE.includes(extName)) {
					POBrowser.openWindowModeless(this.$TOOL.data.get("ATTACH_HOST") + '/office/openppt?attachId=' + attachId + '&extName=' + extName + '&openModeType=4', 'width=1200px;height=800px;scroll=no;');
				} else if (sysConfig.PDF_FILE.includes(extName)) {
					if (this.$TOOL.data.get("OFD_TYPE") !== '0') {
						this.openPdfFile(attachId, extName, 4);
					} else {
						POBrowser.openWindowModeless(this.$TOOL.data.get("ATTACH_HOST") + '/office/openpdf?attachId=' + attachId + '&extName=' + extName + '&openModeType=4', 'width=1200px;height=800px;scroll=no;');
					}
				} else if (sysConfig.IMG_FILE.includes(extName)) {
					const image = new Image()
					image.src = sysConfig.API_URL + '/get/file/getFileDown?attachId=' + attachId + "&extName=" + extName+"&ddtab=true";
					image.onload = () => {
						image.style.margin = "0 auto"
						image.style.display = "block"
						const newWin = window.open("", "_blank")
						newWin.document.write(image.outerHTML)
					}
				}
			} else if (this.$TOOL.data.get("OFFICE_TYPE") === '2') {
				if (sysConfig.DOC_FILE.includes(extName)) {
					window.open(this.$TOOL.data.get("ATTACH_HOST") + '/office/wps/openword?attachId=' + attachId + '&extName=' + extName + '&openModeType=5&model=1&stepRunId=' + this.stepRunId + '&token=' + this.$TOOL.cookie.get("TOKEN")+"&ddtab=true");
				} else if (sysConfig.EXCEL_FILE.includes(extName)) {
					window.open(this.$TOOL.data.get("ATTACH_HOST") + '/office/wps/openexcel?attachId=' + attachId + '&extName=' + extName + '&openModeType=5&token=' + this.$TOOL.cookie.get("TOKEN")+"&ddtab=true");
				} else if (sysConfig.PPT_FILE.includes(extName)) {
					window.open(this.$TOOL.data.get("ATTACH_HOST") + '/office/wps/openppt?attachId=' + attachId + '&extName=' + extName + '&openModeType=5&token=' + this.$TOOL.cookie.get("TOKEN")+"&ddtab=true");
				} else if (sysConfig.PDF_FILE.includes(extName)) {
					this.openPdfFile(attachId, extName, 5)
				} else if (sysConfig.IMG_FILE.includes(extName)) {
					const image = new Image()
					image.src = sysConfig.API_URL + '/get/file/getFileDown?attachId=' + attachId + "&extName=" + extName+"&ddtab=true";
					image.onload = () => {
						image.style.margin = "0 auto"
						image.style.display = "block"
						const newWin = window.open("", "_blank")
						newWin.document.write(image.outerHTML)
					}
				}
			}else if (this.$TOOL.data.get("OFFICE_TYPE") === '3') {
				if(sysConfig.DOC_FILE.includes(extName)||sysConfig.EXCEL_FILE.includes(extName)||sysConfig.PPT_FILE.includes(extName))
				{
					window.open(this.$TOOL.data.get("ATTACH_HOST")+'/v3/weboffice/index?attachId='+attachId+'&extName='+extName+'&openModeType=5&token='+this.$TOOL.cookie.get("TOKEN")+"&ddtab=true");
				}else if(sysConfig.PDF_FILE.includes(extName))
				{
					this.openPdfFile(attachId,extName,5)
				}else if (sysConfig.IMG_FILE.includes(extName)) {
					const image = new Image()
					image.src = sysConfig.API_URL+'/get/file/getFileDown?attachId=' + attachId + "&extName=" + extName+"&ddtab=true";
					image.onload = () => {
						image.style.margin = "0 auto"
						image.style.display = "block"
						const newWin = window.open("", "_blank")
						newWin.document.write(image.outerHTML)
					}
				}
			}
			this.$emit('success', this.uid);
		},
		downFile(attachId, extName) {
			if (this.isPc) {
				window.open(sysConfig.API_URL + '/get/file/getFileDown?attachId=' + attachId + "&extName=" + extName+"&ddtab=true", "_blank");
			} else {
				this.$API.file.attach.downLoadFile.fileDownload({attachId: attachId, extName: extName});
			}
			this.$emit('success', this.uid);
		},
		printFile(attachId, extName) {
			if (this.$TOOL.data.get("OFFICE_TYPE") === '0') {
				if (sysConfig.DOC_FILE.includes(extName)) {
					POBrowser.openWindowModeless(this.$TOOL.data.get("ATTACH_HOST") + '/office/openword?attachId=' + attachId + '&extName=' + extName + '&openModeType=3', 'width=1200px;height=800px;scroll=no;');
				} else if (sysConfig.EXCEL_FILE.includes(extName)) {
					POBrowser.openWindowModeless(this.$TOOL.data.get("ATTACH_HOST") + '/office/openexcel?attachId=' + attachId + '&extName=' + extName + '&openModeType=3', 'width=1200px;height=800px;scroll=no;');
				} else if (sysConfig.PPT_FILE.includes(extName)) {
					POBrowser.openWindowModeless(this.$TOOL.data.get("ATTACH_HOST") + '/office/openppt?attachId=' + attachId + '&extName=' + extName + '&openModeType=3', 'width=1200px;height=800px;scroll=no;');
				} else if (sysConfig.PDF_FILE.includes(extName)) {
					if (this.$TOOL.data.get("OFD_TYPE") !== '0') {
						this.openPdfFile(attachId, extName, 3);
					} else {
						POBrowser.openWindowModeless(this.$TOOL.data.get("ATTACH_HOST") + '/office/openpdf?attachId=' + attachId + '&extName=' + extName + '&openModeType=3', 'width=1200px;height=800px;scroll=no;');
					}
				} else if (sysConfig.IMG_FILE.includes(extName)) {
					const image = new Image()
					image.src = sysConfig.API_URL + '/get/file/getFileDown?attachId=' + attachId + "&extName=" + extName+"&ddtab=true";
					image.onload = () => {
						image.style.margin = "0 auto"
						image.style.display = "block"
						const newWin = window.open("", "_blank")
						newWin.document.write(image.outerHTML)
					}
				}
			} else if (this.$TOOL.data.get("OFFICE_TYPE") === '2') {
				if (sysConfig.DOC_FILE.includes(extName)) {
					window.open(this.$TOOL.data.get("ATTACH_HOST") + '/office/wps/openword?attachId=' + attachId + '&extName=' + extName + '&openModeType=3&token=' + this.$TOOL.cookie.get("TOKEN")+"&ddtab=true");
				} else if (sysConfig.EXCEL_FILE.includes(extName)) {
					window.open(this.$TOOL.data.get("ATTACH_HOST") + '/office/wps/openexcel?attachId=' + attachId + '&extName=' + extName + '&openModeType=3&token=' + this.$TOOL.cookie.get("TOKEN")+"&ddtab=true");
				} else if (sysConfig.PPT_FILE.includes(extName)) {
					window.open(this.$TOOL.data.get("ATTACH_HOST") + '/office/wps/openppt?attachId=' + attachId + '&extName=' + extName + '&openModeType=3&token=' + this.$TOOL.cookie.get("TOKEN")+"&ddtab=true");
				} else if (sysConfig.PDF_FILE.includes(extName)) {
					this.openPdfFile(attachId, extName, 3)
				} else if (sysConfig.IMG_FILE.includes(extName)) {
					const image = new Image()
					image.src = sysConfig.API_URL + '/get/file/getFileDown?attachId=' + attachId + "&extName=" + extName+"&ddtab=true";
					image.onload = () => {
						image.style.margin = "0 auto"
						image.style.display = "block"
						const newWin = window.open("", "_blank")
						newWin.document.write(image.outerHTML)
					}
				}
			}else if (this.$TOOL.data.get("OFFICE_TYPE") === '3') {
				if(sysConfig.DOC_FILE.includes(extName)||sysConfig.EXCEL_FILE.includes(extName)||sysConfig.PPT_FILE.includes(extName))
				{
					window.open(this.$TOOL.data.get("ATTACH_HOST")+'/v3/weboffice/index?attachId='+attachId+'&extName='+extName+'&openModeType=3&token='+this.$TOOL.cookie.get("TOKEN")+"&ddtab=true");
				}else if(sysConfig.PDF_FILE.includes(extName))
				{
					this.openPdfFile(attachId,extName,3)
				}else if (sysConfig.IMG_FILE.includes(extName)) {
					const image = new Image()
					image.src = sysConfig.API_URL+'/get/file/getFileDown?attachId=' + attachId + "&extName=" + extName;
					image.onload = () => {
						image.style.margin = "0 auto"
						image.style.display = "block"
						const newWin = window.open("", "_blank")
						newWin.document.write(image.outerHTML)
					}
				}
			}
			this.$emit('success', this.uid);
		},
		readFile(attachId, extName) {
			if (this.$TOOL.data.get("OFFICE_TYPE") === '0') {
				if (sysConfig.DOC_FILE.includes(extName)) {
					POBrowser.openWindowModeless(this.$TOOL.data.get("ATTACH_HOST") + '/office/openword?attachId=' + attachId + '&extName=' + extName + '&openModeType=1', 'width=1200px;height=800px;scroll=no;');
				} else if (sysConfig.EXCEL_FILE.includes(extName)) {
					POBrowser.openWindowModeless(this.$TOOL.data.get("ATTACH_HOST") + '/office/openexcel?attachId=' + attachId + '&extName=' + extName + '&openModeType=1', 'width=1200px;height=800px;scroll=no;');
				} else if (sysConfig.PPT_FILE.includes(extName)) {
					POBrowser.openWindowModeless(this.$TOOL.data.get("ATTACH_HOST") + '/office/openppt?attachId=' + attachId + '&extName=' + extName + '&openModeType=1', 'width=1200px;height=800px;scroll=no;');
				} else if (sysConfig.PDF_FILE.includes(extName)) {
					if (this.$TOOL.data.get("OFD_TYPE") !== '0') {
						this.openPdfFile(attachId, extName, 1);
					} else {
						POBrowser.openWindowModeless(this.$TOOL.data.get("ATTACH_HOST") + '/office/openpdf?attachId=' + attachId + '&extName=' + extName + '&openModeType=1', 'width=1200px;height=800px;scroll=no;');
					}
				} else if (sysConfig.IMG_FILE.includes(extName)) {
					const image = new Image()
					image.src = sysConfig.API_URL + '/get/file/getFileDown?attachId=' + attachId + "&extName=" + extName;
					image.onload = () => {
						image.style.margin = "0 auto"
						image.style.display = "block"
						const newWin = window.open("", "_blank")
						newWin.document.write(image.outerHTML)
					}
				}
			} else if (this.$TOOL.data.get("OFFICE_TYPE") === '2') {
				if (sysConfig.DOC_FILE.includes(extName)) {
					window.open(this.$TOOL.data.get("ATTACH_HOST") + '/office/wps/openword?attachId=' + attachId + '&extName=' + extName + '&openModeType=1&token=' + this.$TOOL.cookie.get("TOKEN"));
				} else if (sysConfig.EXCEL_FILE.includes(extName)) {
					window.open(this.$TOOL.data.get("ATTACH_HOST") + '/office/wps/openexcel?attachId=' + attachId + '&extName=' + extName + '&openModeType=1&token=' + this.$TOOL.cookie.get("TOKEN"));
				} else if (sysConfig.PPT_FILE.includes(extName)) {
					window.open(this.$TOOL.data.get("ATTACH_HOST") + '/office/wps/openppt?attachId=' + attachId + '&extName=' + extName + '&openModeType=1&token=' + this.$TOOL.cookie.get("TOKEN"));
				} else if (sysConfig.PDF_FILE.includes(extName)) {
					this.openPdfFile(attachId, extName, 1)
				} else if (sysConfig.IMG_FILE.includes(extName)) {
					const image = new Image()
					image.src = sysConfig.API_URL + '/get/file/getFileDown?attachId=' + attachId + "&extName=" + extName;
					image.onload = () => {
						image.style.margin = "0 auto"
						image.style.display = "block"
						const newWin = window.open("", "_blank")
						newWin.document.write(image.outerHTML)
					}
				}
			}else if (this.$TOOL.data.get("OFFICE_TYPE") === '3') {
				if(sysConfig.DOC_FILE.includes(extName)||sysConfig.EXCEL_FILE.includes(extName)||sysConfig.PPT_FILE.includes(extName))
				{
					window.open(this.$TOOL.data.get("ATTACH_HOST")+'/v3/weboffice/index?attachId='+attachId+'&extName='+extName+'&openModeType=1&token='+this.$TOOL.cookie.get("TOKEN"));
				}else if(sysConfig.PDF_FILE.includes(extName))
				{
					this.openPdfFile(attachId,extName,1)
				}else if (sysConfig.IMG_FILE.includes(extName)) {
					const image = new Image()
					image.src = sysConfig.API_URL+'/get/file/getFileDown?attachId=' + attachId + "&extName=" + extName;
					image.onload = () => {
						image.style.margin = "0 auto"
						image.style.display = "block"
						const newWin = window.open("", "_blank")
						newWin.document.write(image.outerHTML)
					}
				}
			}
			this.$emit('success', this.uid);
		},
		previewFile(attachId, extName) {
			if (this.isPc) {
				if (this.$TOOL.data.get("OPEN_ON_LINE_FLAG") === '0') {
					this.$nextTick(() => {
						window.open('/#/file/preview?attachId=' + attachId + "&extName=" + extName, "_blank");
					})
				} else if (this.$TOOL.data.get("OPEN_ON_LINE_FLAG") === '2') {
					if (sysConfig.DOC_FILE.includes(extName)) {
						if (extName === '.docx') {
							this.$nextTick(() => {
								window.open('/#/file/preview/word?attachId=' + attachId + "&extName=" + extName, "_blank");
							})
						} else {
							this.$nextTick(() => {
								window.open('/#/file/preview?attachId=' + attachId + "&extName=" + extName, "_blank");
							})
						}
					} else if (sysConfig.EXCEL_FILE.includes(extName)) {
						if (extName === '.xlsx') {
							this.$nextTick(() => {
								window.open('/#/file/preview/excel?attachId=' + attachId + "&extName=" + extName, "_blank");
							})
						} else {
							this.$nextTick(() => {
								window.open('/#/file/preview?attachId=' + attachId + "&extName=" + extName, "_blank");
							})
						}
					} else if (sysConfig.PPT_FILE.includes(extName)) {
						if(extName===".pptx") {
							this.$nextTick(() => {
								window.open('/#/file/preview/ppt?attachId=' + attachId + "&extName=" + extName, "_blank");
							})
						}else{
							this.$nextTick(() => {
								window.open('/#/file/preview?attachId=' + attachId + "&extName=" + extName, "_blank");
							})
						}
					} else if (sysConfig.PDF_FILE.includes(extName)) {
						this.openPdfFile(attachId, extName, 1);
					} else if (sysConfig.IMG_FILE.includes(extName)) {
						const image = new Image()
						image.src = sysConfig.API_URL + '/get/file/getFileDown?attachId=' + attachId + "&extName=" + extName;
						image.onload = () => {
							image.style.margin = "0 auto"
							image.style.display = "block"
							const newWin = window.open("", "_blank")
							newWin.document.write(image.outerHTML)
						}
					}
				}
			} else {
				let url="/app/file/preview";
				if (sysConfig.DOC_FILE.includes(extName)) {
					if(extName==='.docx')
					{
						url="/app/file/preview/word";
					}
				} else if (sysConfig.EXCEL_FILE.includes(extName)) {
					if (extName === '.xlsx') {
						url="/app/file/preview/excel";
					}
				} else if (sysConfig.PPT_FILE.includes(extName)) {
					url="/app/file/preview/ppt";
				} else if (sysConfig.PDF_FILE.includes(extName)) {
					if(extName==='.ofd')
					{
						url="/app/file/preview/ofd";
					}
				} else if (sysConfig.IMG_FILE.includes(extName)) {
					url='/app/file/preview/image';
				}
				this.$nextTick(() => {
					this.$router.replace({
						path: url,
						query: {
							attachId: attachId,
							extName: extName
						}
					})
				})
			}
			this.$emit('success', this.uid);
		},
		showFileVersion(attachId, extName) {
			this.$emit('showVersion', attachId);
		},
		openPdfFile(attachId, extName, openModeType) {
			if (this.$TOOL.data.get("OFD_TYPE") === '0') {
				if(extName=='.ofd')
				{
					this.$nextTick(() => {
						window.open('/#/file/preview/ofd?attachId=' + attachId + "&extName=" + extName, "_blank");
					})
				}else {
					this.$nextTick(() => {
						window.open('/#/file/preview/pdf?attachId=' + attachId + "&extName=" + extName, "_blank");
					})
				}
			} else if (this.$TOOL.data.get("OFD_TYPE") === '1') {
				this.$nextTick(() => {
					window.open(this.$TOOL.data.get("ATTACH_HOST") + '/office/ofd/openfxofd?attachId=' + attachId + "&openModeType=" + openModeType + "&extName=" + extName, "_blank");
				})
			} else if (this.$TOOL.data.get("OFD_TYPE") === '2') {
				this.$nextTick(() => {
					window.open(this.$TOOL.data.get("ATTACH_HOST") + '/office/ofd/openswofd?attachId=' + attachId + "&openModeType=" + openModeType + "&extName=" + extName, "_blank");
				})
			}
		},
	}
}
</script>
<style>
.el-dropdown-link {
	cursor: pointer;
	color: #2a64a6;
}
</style>
